<template>
    <div class="sensitive">
        <!-- 员工管理 -->
        <ZWGroup ref="groupRef" :type="20" :group-id="selectid" :auth-code="authCode" @submit="getclickid" />
        <div class="right-content">
            <!-- 中间表格 -->
            <Tablelist ref="tableRef" :selectid="selectid" @init="initpage" @refreshData="refreshData"></Tablelist>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { ref, nextTick } from 'vue';
import Tablelist from './components/Tablelist.vue';
import ZWGroup from '@/components/ZWGroup.vue';
import { endLoading } from '@/utils/request';
const groupRef = ref(null);
const tableRef = ref(null);
const selectid = ref('all');
// 分组权限code码
const authCode = {
    add: 'ADD_CHILD_GROUP',
    edit: 'EDIT_CHILD_GROUP',
    del: 'DEL_CHILD_GROUP'
};
const initpage = async () => {
    await nextTick();
};
const getclickid = async (data: any) => {
    selectid.value = data.id;
    await nextTick();
    tableRef.value.search();
};
const refreshData = async (groupId: any) => {
    if (groupId) {
        await groupRef.value.setCurrentSelectId({ id: groupId });
        selectid.value = groupId;
    }
    await groupRef.value.getGroup(20);
};
</script>

<style lang="scss" scoped>
.sensitive {
    display: flex;

    .right-content {
        flex: 1;
        height: calc(100vh - 142px);
        padding: 24px;
        border: 1px solid #eaeaea;
        border-radius: 4px;
        box-sizing: border-box;
        background-color: #fff;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
}
</style>
